home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / MATHS / RLAB / RLAB125.ZIP / !RLaB / rlib / whos < prev   
Text File  |  1994-09-23  |  1KB  |  52 lines

  1. //-------------------------------------------------------------------//
  2.  
  3. //  Syntax:  whos ( L )
  4.  
  5. //  Description:
  6.  
  7. //  The whos function prints a tabular listing (to stdout) of the
  8. //  contents of the list, or symbol-table L. Information on functions
  9. //  is not output. If no argument is provided whos prints out 
  10. //  information from the global-symbol table.
  11.  
  12. //  See Also: sizeof, who, what
  13.  
  14. //-------------------------------------------------------------------//
  15.  
  16. static (whos_1, Btotal);
  17.  
  18. whos = function ( LIST )
  19. {
  20.   Btotal = 0;
  21.   if (!exist (LIST)) 
  22.   {
  23.     whos_1 ($$);
  24.   else
  25.     whos_1 (LIST);
  26.   }
  27.   printf ("Total MBytes = %f\n", Btotal/1.e6);
  28. };
  29.  
  30. whos_1 = function ( LIST )
  31. {
  32.   printf ("\tName            Class\tType\tSize\t\tNBytes\n");
  33.   for (i in members (LIST))
  34.   {
  35.     nbytes = sizeof (LIST.[i]);
  36.     Btotal = Btotal + nbytes;
  37.     if (class (LIST.[i]) == "function") { continue }
  38.     if (class (LIST.[i]) == "list")
  39.     {
  40.       m = size (LIST.[i]);
  41.       printf ("\t%-15s", i);
  42.       printf ("\t%s\t%s\t%i\t\t%i\n", ...
  43.               class (LIST.[i]), type (LIST.[i]), m[1], nbytes);
  44.     else
  45.       m = size (LIST.[i]);
  46.       printf ("\t%-15s", i);
  47.       printf ("\t%s\t%s\t%i\t%i\t%i\n", ...
  48.               class (LIST.[i]), type (LIST.[i]), m[1], m[2], nbytes);
  49.     }
  50.   }
  51. };
  52.